//
//  YunHomeVC.swift
//  YunChenCalculator
//
//  Created by Li Dong on 2023/10/16.
//

import UIKit

class YunHomeVC: YunBaseVC {
    
    
    @IBOutlet weak var settingBtn_top: NSLayoutConstraint!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        hideNavgaitionBar()
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        if AppProducts.shared.isPurchased {
            adHelper.removeBannerView()
        }else{
            if hasLoadAd {
                return
            }
            hasLoadAd = true
            adHelper.loadBanner(currentVC: self, isMainVC: false)
        }
    }

    @IBAction func settingHandler(_ sender: Any) {
        navigationController?.pushViewController(YunSetupVC(), animated: true)
    }
    
    @IBAction func itemHandler(_ sender: UIButton) {
        if !AppProducts.shared.isPurchased {
            showSubVC()
            return
        }
        switch sender.tag {
        case 100:
            navigationController?.pushViewController(YunWebVC(url: AppConfig.H5_URL), animated: true)
            break
        case 200:
            navigationController?.pushViewController(YunGridVC(), animated: true)
            break
        case 300:
            navigationController?.pushViewController(YunFoodPhotoVC(), animated: true)
            break
        default:
            break
        }
    }
    
}
